package gamegui;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Color;
import java.awt.Toolkit;

import javax.swing.UIManager;
import javax.swing.border.TitledBorder;

public class ScorePanel extends JPanel {

	/**
	 * Create the panel.
	 */
	

	public ScorePanel() {
		final ImageIcon icon1 = new ImageIcon("player1.jpg");
		final ImageIcon icon2 = new ImageIcon("player2.jpg");
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 0, 0 };
		gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
		gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
		setLayout(gridBagLayout);

		JPanel panel = new JPanel() {
			public void paintComponent(Graphics g) {
				Dimension d = getSize();
				g.drawImage(icon1.getImage(), 0, 0, d.width, d.height, null);
				setOpaque(false);
				super.paintComponent(g);
			}
		};
		panel.setBorder(new TitledBorder(null, "Player 1",
				TitledBorder.LEADING, TitledBorder.TOP, null, Color.RED));
		panel.setBackground(Color.WHITE);
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.insets = new Insets(0, 0, 5, 0);
		gbc_panel.fill = GridBagConstraints.BOTH;
		gbc_panel.gridx = 0;
		gbc_panel.gridy = 0;
		add(panel, gbc_panel);

		JPanel panel_1 = new JPanel() {
			public void paintComponent(Graphics g) {
				Dimension d = getSize();
				g.drawImage(icon2.getImage(), 0, 0, d.width, d.height, null);
				setOpaque(false);
				super.paintComponent(g);
			}
		};
		panel_1.setBorder(new TitledBorder(null, "Player 2",
				TitledBorder.LEADING, TitledBorder.TOP, null, Color.GREEN));
		panel_1.setBackground(Color.WHITE);
		GridBagConstraints gbc_panel_1 = new GridBagConstraints();
		gbc_panel_1.fill = GridBagConstraints.BOTH;
		gbc_panel_1.gridx = 0;
		gbc_panel_1.gridy = 1;
		add(panel_1, gbc_panel_1);

	}

//	public static void main(String args[]) {
//		JFrame f = new JFrame();
//		f.add(new ScorePanel());
//		f.setSize(300,300);
//		f.setVisible(true);
//	}
}
